Skip to content

feat(dfns): name period lists period_data - #408

Closed
wpbonelli wants to merge 2 commits into
MODFLOW-ORG:developfrom
wpbonelli:period-data
Closed

wpbonelli wants to merge 2 commits into
MODFLOW-ORG:developfrom
wpbonelli:period-data

Conversation

@wpbonelli

Copy link
Copy Markdown
Member

flopy4 renamed stress_period_data to period_data on every package (modflowpy/pyphoenix-project#540), and maps the DFN name in its codegen and grammar builder. This names the lists period_data in the dev2 migration so that mapping can be removed.

Most of the diff is regenerated snapshots: 354 files, 177 each in v2.0.0.dev2 and v2.0.0.dev3, all differing from develop only by the rename. dev0 and dev1 are unchanged.

Migration

  • Name: _PERIOD_LIST_NAME is now period_data, and STO's scalar in _collapse_sto_keywords uses it too.
  • _FK_BACKFILL: it keeps stress_period_data for chf-cdb, chf-zdg and olf-zdg. This is deliberate: it's the v1 name, which _apply_fk_backfill needs because it runs before _name_period_lists.
  • _retarget_fk_backfill: it runs after _name_period_lists, so it now looks period lists up by their final name. Without this it silently skips them, and the fk stays on idcxs even when chf-cxs's key is ifno. The snapshots can't catch that while the pinned DFNs use idcxs, but test_migrate_cross_section_keys[ifno] does.

Worth checking in review

  • No schema version bump: dev2 is edited in place. The name never appears in an input file, and fix(dfns): name STO's period field stress_period_data #398 set the precedent. Code indexing fields["stress_period_data"], or holding dev2/dev3 files written earlier, will break. Only flopy4 was checked for this.
  • item.name is unchanged: list items keep their v1-derived names, so 31 stress packages still have item.name = "stress_period_data" under period_data. Other period lists already differ in the same way (perioddata, lakeperioddata, output_record, ...).

Testing

pytest autotest/dfns: 692 passed, 2 skipped, 1752 snapshots passed. The 2 skips need GitHub network access or a release asset.

An earlier trial of this change against flopy4's period-data branch produced no generated-code diff. That trial used a literal for STO's name rather than _PERIOD_LIST_NAME, and it wasn't rerun on this commit.

After merging

flopy4 needs a follow-up that bumps its lock, removes its name mapping, and fixes test_legacy_period_kwargs_match_dfns, which fails with the new name.

🤖 Generated with Claude Code

wpbonelli and others added 2 commits November 5, 2026 12:01
flopy4 is renaming stress_period_data to period_data on every package, and
currently maps the name in its codegen and grammar builder. Name the lists
period_data in the dev2 migration so that mapping can go. The name never
appears in an input file, so MF6 input is unaffected and there is no schema
version bump.

_FK_BACKFILL keeps the v1 name, since _apply_fk_backfill runs before
_name_period_lists. _retarget_fk_backfill runs after it, so it now looks
period lists up by their final name. Without this it silently skips them,
which the snapshots don't catch while the pinned DFNs use idcxs.

List items keep their v1-derived names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The gwf-oc and prt-prp descriptions and the gwf-mvr example still used
older period list names. Also correct the comment on List.children, since
an item's name doesn't generally match its list's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wpbonelli wpbonelli closed this Nov 5, 2026
@wpbonelli
wpbonelli deleted the period-data branch November 5, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant